var ClubTableWindow = Window.extend({
    _ccsFileName: res.ClubTableWindow_json,
    _clubId: null,
    _tableViewList: [],
    _currentFloor: 0,
    _skipNum: 0,    //牌桌跳过个数
    _limitNum: 12,   //牌桌请求个数
    _tableViewSlideMax: false,
    _tableView: null,
    _roomHideBtns: [],
    //控制刷新桌子。第一次进入时只有收到ClubBaseInfo和ListClubRoom后才显示桌子
    _firstDataRequest: {
        ClubBaseInfo: true,
        ListClubRoom: true,
    },

    _liaobeiBind: null,
    initWindow: function () {
        this._tableViewList = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        this._initTableView();
        this._liaobeiBind = new ClubLiaoBeiUnit();
        this._liaobeiBind.initUnit();
        this.addChild(this._liaobeiBind);
    },

    autoPoint: function () {
        this._nodeList['unit_ClubShowRoomUnit'].setVisible(false);
        this._nodeList['unit_ClubShowRoomUnit'].x = display.cx - 296;
        this._nodeList['unit_ClubShowRoomUnit'].y = -display.cy;
        //适配不同机型，当前楼层标志永远显示在屏幕左侧固定位置
        var screenOrigin = -display.cx;
        this._nodeList['currentFloor'].x = screenOrigin + 25;
        this._nodeList['unit_ClubTableMemberUnit'].x = screenOrigin + 40;
        //#region 暂时屏蔽在线状态
        this._nodeList['unit_ClubTableMemberUnit'].setVisible(false);
        //#endregion
    },

    /**
     * View基类初始化
     */
    initView: function () {
        this._actionType = ViewActionType.None;
        if (this._actionType === ViewActionType.None) {
            this._rootNode.show();
        }
        this._loadCCSFinished = true;
        this.setData.apply(this, arguments);
    },

    resetAllListeners: function () {
        this._initAllListeners();
    },

    open: function (clubId) {
        this._initTableView();
        this._openTableWindowInfo = true;

        this._tableView.setTouchEnabled(true);
        // this._addClickListeners();
        this._clubId = clubId;
        gameData.returnClubId = clubId;
        this._tableViewList = [];
        this._refreshFloorView(0); //默认显示混合玩法楼层

        this._firstDataRequest = {ClubBaseInfo: true, ListClubRoom: true};
        this._initBtnsView();
        this.autoPoint();
        ClubDataManager.setClubTableWindowState(false);
        this.setRoomStyleClub(false);
        //this._setOptBtnRetract(false);

        clubMsgManager.requestClubBaseInfo(this._clubId);
        this.requestListRoom();
        //延迟请求 亲友圈消息 和 updateLocal消息。避免因为发送过多，服务器返回时。客户端解析消息队列(50毫秒) 造成的卡顿
        setTimeout(function () {
            clubMsgManager.requestClubMsg(this._clubId);
            network.send(2103, {cmd: ClubMsgCode.UpdateLocal, club_id: this._clubId, location: 1});
        }.bind(this), 100);
        this._nodeList['btn_invite'].setVisible(ClubDataManager.isSelfAdministration(clubId, gameData.uid));

        var clubInfo = ClubDataManager.getClubData(clubId);
        if (clubInfo) {
            club.onEnterTableView(clubInfo['owner_uid'] == gameData.uid, ((clubInfo['admins'] && clubInfo['admins'].indexOf(gameData.uid) >= 0)));
        }
        this.schedule(this._memberOffLineTimer, 3);
    },

    _memberOffLineTimer: function () {
        var currentTime = new Date().getTime();
        var allMember = ClubDataManager.getClubMembers(this._clubId);
        var memberMap = ClubDataManager.getClubMemberMap(this._clubId);
        for (var i = 0; i < allMember.length; i++) {
            var member = allMember[i];
            if (!member['offLineTime']) {
                continue;
            }
            allMember[i].offLineTimerStr = ClubDataManager.getTimeDifferenceFormat(currentTime, member['offLineTime'] * 1000);
            memberMap[member.uid] = allMember[i];
        }
        eventManager.dispatchEvent(ClubEvent.RefreshOffLineEvent);
    },


    /**
     * 设置桌内样式
     */
    setRoomStyleClub: function (state) {
        ClubDataManager.setClubTableWindowState(state);
        this._roomHideBtns = [];
        this._nodeList['btn_invite'].setVisible(!state);
        this._nodeList['btn_createRoom'].setVisible(!state);
        this._nodeList['btn_quickJoin'].setVisible(!state);
        this._nodeList['unit_ClubShowRoomUnit'].setVisible(state);
        if (state) {
            eventManager.dispatchEvent(ClubEvent.ClubShowRoomUnitRefresh);
            this._roomHideBtns = ['btn_quickJoin', 'opt.btn_set', 'btn_invite', 'opt.btn_member', 'btn_createRoom'];
        }
        //this._setOptBtnRetract(true);
    },


    _initBtnsView: function () {
        this._nodeList['currentFloor'].setVisible(false);
        this._nodeList['btn_quickJoin'].setVisible(false);
        this._nodeList['btn_createRoom'].setVisible(false);
        var isAdmin = ClubDataManager.isSelfAdministration(this._clubId, gameData.uid);
        this._nodeList['bg_bottom.btn_DataStatistics'].setVisible(isAdmin ? true : false);
        this._nodeList['btn_groupManager'].setVisible(isAdmin? true : false);
        /*
        var all_optBtn = ['opt.btn_member', 'opt.btn_set', 'opt.btn_bindLiaoBei', 'opt.btn_onEnter', 'opt.btn_refresh'];
        for (var i = 0; i < all_optBtn.length; i++) {
            this._nodeList[all_optBtn[i]].setPosition(this._nodeList['opt.btn_retract'].getPosition());
            this._nodeList[all_optBtn[i]].setVisible(false);
        }
        this._nodeList['opt.btn_retract'].setVisible(true);
        this._nodeList['opt.btn_retract2'].setVisible(false);
         */
    },

    /**
     * 初始化TableView
     * @private
     */
    _initTableView: function () {
        if (this._tableView) return;
        var nodeContent = this._nodeList['tableView'];
        var tableViewSize = nodeContent.getContentSize();
        nodeContent.setContentSize(cc.size(display.width, tableViewSize.height));
        this._tableView = new cc.TableView(this, cc.size(display.width, tableViewSize.height));
        this._tableView.setDelegate(this);
        this._tableView.setDirection(cc.SCROLLVIEW_DIRECTION_HORIZONTAL);
        this._tableView.setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN);
        // this._tableView.y = nodeContent.y;
        // this._tableView.x = 40;
        nodeContent.addChild(this._tableView);
    },

    _initClickListeners: function () {
        this._clickListeners = {
            'touchLayer': '_clickTouchLayer',
            'btn_close': '_clickClose',
            'btn_invite': '_clickInvite',
            'btn_quickJoin': '_clickQuickJoin',
            'btn_createRoom': '_clickCreateRoom',
            'opt.btn_bindLiaoBei': '_clickBindLiaoBei',
            'opt.btn_onEnter': '_clickonEnterLiaobei',
            'opt.btn_refresh': '_clickRefresh',
            'opt.btn_set': '_clickSet',
            'bg_bottom.btn_sys': '_clickSys',
            'opt.btn_member': '_clickMember',
            'bg_bottom.btn_zhanbang': '_clickZhanBang',
            'bg_bottom.btn_DataStatistics': '_clickDataStatistics',
            'opt.btn_retract': '_clickRetractOpt',
            'opt.btn_retract2': '_clickRetractOpt',
            'btn_groupManager' : '_clickGroupManager',
        };
    },

    /**
     * 监听亲友圈消息
     * @private
     */
    _initEventListeners: function () {
        this._eventListeners = {};
        //监听 消息 事件
        this._eventListeners[ClubMsgCode.ClubBaseInfo] = '_clubBaseInfoHandler';
        this._eventListeners[ClubMsgCode.ListClubRoom] = '_listClubRoomHandler';
        this._eventListeners[ClubMsgCode.DeleteClub] = '_deleteClubHandler';
        this._eventListeners[ClubMsgCode.LeaveClub] = '_deleteClubHandler';
        this._eventListeners[ClubMsgCode.ClubParamSet] = '_clubParamSetHandler';
        this._eventListeners[ClubMsgCode.QueryWanfas] = '_wanfaChangeHandler';
        this._eventListeners[ClubMsgCode.AddWanfa] = '_wanfaChangeHandler';
        this._eventListeners[ClubMsgCode.DelWanfa] = '_wanfaChangeHandler';
        this._eventListeners[ClubMsgCode.ModWanfa] = '_wanfaChangeHandler';
        this._eventListeners[ClubMsgCode.ModifyClub] = '_clubModifyClubHandler';
        this._eventListeners[ClubMsgCode.SetHours] = '_clubModifyClubHandler';
        this._eventListeners[ClubMsgCode.QueryMSG] = '_queryMSGHandelr';
        this._eventListeners[ClubMsgCode.RemoveClubMember] = '_removeClubMemberHandler';

        //监听UI 事件
        this._eventListeners[ClubEvent.SelectFloor] = '_selectFloor';
        this._eventListeners[ClubEvent.ClubTableWindowClose] = '_clubTableWindowClose';
    },


    _clickInvite: function () {
        // this.addChild(new ClubInviteLayer(this._clubId));
        showWindow('ClubInviteWindow', this._clubId);
    },
    _clickQuickJoin: function () {
        var floorWanfaInfo = ClubDataManager.getClubFloorWanfaInfo(this._clubId, this._currentFloor);
        if (!floorWanfaInfo.length) {
            showAlert('请先设置玩法');
            return;
        }
        if (ClubDataManager.getUidIsBackList(this._clubId, gameData.uid)) {
            showAlert('你已被管理员禁玩,请联系管理员~');
            return;
        }

        if (this._currentFloor == 0) {
            showWindow('ClubBlendQuickJoinWindow', this._clubId);
            return;
        }


        var wanfaInfo = ClubDataManager.analysisWanFaInfo(JSON.parse(floorWanfaInfo.options));
        var playerMap = wanfaInfo.playerMap; //当前玩法所支持的玩家人数
        var keys = _.keys(playerMap);
        if (keys.length > 1) {
            showWindow("ClubQuickJoinWindow", this._clubId, this._currentFloor);
            return;
        }
        clubMsgManager.requestQuickJoinRoom(this._clubId, this._currentFloor);
    },
    //暂时去掉 混合楼层 创建玩法功能
    _clickCreateRoom: function () {
        // var clubInfo = ClubDataManager.getClubData(this._clubId);
        // if (ClubDataManager.getUidIsBackList(this._clubId, gameData.uid)) {
        //     showAlert('你已被管理员禁玩,请联系管理员~');
        //     return;
        // }
        // if (clubInfo.param && clubInfo.param.free_play) {
        //     if (clubInfo.param.free_play == 'open') {
        //         showWindow('WanFaWindow', this._clubId, 0);
        //         return;
        //     }
        // }
        // showAlert('混合玩法未开启，请联系群主');
    },

    /**
     * 聊呗绑定群功能
     * @private
     */
    _clickBindLiaoBei: function () {
        this._liaobeiBind.liaoBeiQunBind(this._clubId);
    },
    /**
     * 聊呗入群功能
     * @private
     */
    _clickonEnterLiaobei: function () {
        this._liaobeiBind.liaoBeiQunOnEnter(this._clubId);
    },

    _clickRefresh: function () {
        clubMsgManager.requestClubBaseInfo(this._clubId, true);
        clubMsgManager.requestListClubRoom(this._clubId, this._skipNum, this._limitNum, null, true);
        clubMsgManager.requestClubMsg(this._clubId);
    },

    _clickSet: function () {
        showWindow('ClubSettingWindow', this._clubId);
    },

    _clickSys: function () {
        var msgCount = 0;
        if (this._nodeList['bg_bottom.btn_sys.numbg'].isVisible()) {
            msgCount = parseInt(this._nodeList['bg_bottom.btn_sys.numbg.num'].getString());
        }
        showWindow('ClubManagementWindow', this._clubId, msgCount);
    },

    _clickMember: function () {
        showWindow('ClubMemberWindow', this._clubId);
    },

    _clickZhanBang: function () {
        showWindow('ClubStatisticsWindow', this._clubId,'zhanji');
    },
    _clickDataStatistics: function(){
        showWindow('ClubStatisticsWindow', this._clubId,'shuju');
    },
    _clickGroupManager: function(){
        showWindow('ClubGroup_MainWindow', this._clubId,'shuju');
    },
    /**
     * 右上角功能按钮 弹出收回
     * @param target
     * @private
     */
    _clickRetractOpt: function (target) {
        var targetName = target.getName();
        var isRetract = false;
        if (targetName == 'btn_retract2') {
            //收回按钮
            isRetract = true;
        }
        this._setOptBtnRetract(isRetract);
    },

    _setOptBtnRetract: function (isRetract) {
        this._nodeList['opt.btn_retract'].setVisible(isRetract);
        this._nodeList['opt.btn_retract2'].setVisible(!isRetract);
        this._optBtnRetract(isRetract);
    },


    requestListRoom: function () {
        clubMsgManager.requestListClubRoom(this._clubId, this._skipNum, this._limitNum);
        this._skipNum += this._limitNum;
    },

    _clubBaseInfoHandler: function (data) {
        hideLoading();
        this._refreshBlendCreateRoom();

        this._clubId = this._clubId || data['club_id'];

        if (ClubDataManager.getClubIsShutDown(this._clubId)) {//开启了时间 并且不在范围内
            this.addChild(new ClubDayangLayer(this._clubId));
        }

        //只有第一次收到亲友圈数据时需要是刷新桌子
        //因为刷新桌子需要ClubBaseInfo里的wanfas数据
        //之后本地已经有了wanfas数据 在收到clubBaseInfo时就不需要刷新桌子了
        //避免因为修改公告或者其他功能时 服务器推送clubBaseInfo而导致桌子刷新
        if (this._firstDataRequest['ClubBaseInfo']) {
            this._firstDataRequest['ClubBaseInfo'] = false;
            this._refreshTable();
        }
    },

    _clubModifyClubHandler: function () {
        //这里不需要做任何事情
    },
    _removeClubMemberHandler: function (data) {
        if (data['result'] == 0) {
            var exist = false;
            var members = data['info']['member'];
            for (var i = 0; i < members.length; i++) {
                if (members[i].u == gameData.uid) {
                    exist = true;
                    break;
                }
            }
            if (!exist) {
                if (this.isVisible()) {
                    this._clickClose();
                }
            }
        }

    },

    /**
     * 亲友圈消息
     * @private
     */
    _queryMSGHandelr: function (data) {
        if (data.result != 0) {
            showAlert(data['msg']);
            return;
        }
        var count = 0;
        for (var i = 0; i < data['arr'].length; i++) {
            var obj = data['arr'][i];
            //有玩家申请加入亲友圈
            // if (obj.type == 'apply') {
            //     count++;
            // }
            //有人申请合并亲友圈
            if (obj['detail'] && obj['detail']['cmd'] == ClubMsgCode.ApplyComboClub && obj['detail']['club_id'] == this._clubId) {
                count++;
            } else if (obj.club_id == this._clubId) {
                count++;
            }
        }

        if (count > 0) {
            //this._nodeList['opt.btn_retract.numbg'].setVisible(true);
            //this._nodeList['opt.btn_retract.numbg.num'].setString(count);

            this._nodeList['bg_bottom.btn_sys.numbg'].setVisible(true);
            this._nodeList['bg_bottom.btn_sys.numbg.num'].setString(count);
        } else {
            this._nodeList['bg_bottom.btn_sys.numbg'].setVisible(false);
            //this._nodeList['opt.btn_retract.numbg'].setVisible(false);
        }
    },

    _listClubRoomHandler: function (data) {
        hideLoading();
        if (data['result'] != 0) {
            this._tableViewSlideMax = true;
        }
        if (ClubDataManager.getClubTableWindowState()) {
            eventManager.dispatchEvent(ClubEvent.ClubShowRoomUnitRefresh);
        }
        this._firstDataRequest['ListClubRoom'] = false;
        this._refreshTable();
    },

    /**
     * 亲友圈设置
     * @param data
     * @private
     */
    _clubParamSetHandler: function (data) {
        var clubInfo = ClubDataManager.getClubData(data['club_id']);
        clubInfo.param = data['info']['param'];
        ClubDataManager.refreshClubData(data['club_id'], clubInfo);
        this._refreshBlendCreateRoom();
    },

    /**
     * 收到删除亲友圈消息
     * @param data
     * @private
     */
    _deleteClubHandler: function (data) {
        hideLoading();
        if (data['result'] != 0) {
            showAlert(data['msg']);
            return;
        }
        showAlert(data['msg']);
        this._clickClose();
    },

    /**
     * 楼层玩法改变 消息
     * @param data
     * @private
     */
    _wanfaChangeHandler: function (data) {
        hideLoading();
        if (data['result'] != 0) {
            showAlert(data['msg']);
            return;
        }
        var clubInfo = ClubDataManager.getClubData(data['club_id']);
        clubInfo.wanfas = data['info']['wanfas'];
        ClubDataManager.refreshClubData(data['club_id'], clubInfo);
        this._selectFloor(this._currentFloor);
        eventManager.dispatchEvent(ClubEvent.QueryWanfas, this._clubId);
    },

    /**
     * 刷新混合楼层 创建房间按钮显隐
     * @private
     */
    _refreshBlendCreateRoom: function () {
        this._nodeList['btn_quickJoin'].setVisible(true);
        this._nodeList['btn_createRoom'].setVisible(false);
    },

    /**
     * 获取当前选中的是否为混合玩法
     * @private
     */
    _getCurrentSelectBlend: function () {
        return this._currentFloor == 0;
    },

    _refreshFloorView: function (floor) {
        this._currentFloor = floor;
        //选中的楼层是否为 混合玩法
        var isBlendRoom = this._getCurrentSelectBlend();
        //#region 暂时屏蔽在线状态
        //this._nodeList['unit_ClubTableMemberUnit'].setVisible(isBlendRoom);
        this._nodeList['unit_ClubTableMemberUnit'].setVisible(false);
        //#endregion
        this._nodeList['currentFloor'].setVisible(!isBlendRoom);
        if (!isBlendRoom) {
            this._nodeList['currentFloor'].setTexture(res['clubFloor' + floor]);
        }
        this._refreshBlendCreateRoom(floor);
    },


    _selectFloor: function (floor) {
        var isRefresTableView = !(this._currentFloor == floor);
        this._currentFloor = floor;
        this._refreshFloorView(floor);
        this._refreshTableViewListData();
        if (isRefresTableView) {
            var nodeContent = this._nodeList['tableView'];
            var tableViewSize = nodeContent.getContentSize();
            this._tableView.getContainer().setContentSize(cc.size(display.width, tableViewSize.height));
            this._tableView.reloadData();
        } else {
            this._refreshTableView();
        }
    },


    _refreshTableViewListData: function () {
        var tableList = this.getViewTableData(this._currentFloor);
        this._tableViewList = [];
        var i = 0;
        var tablecolumnNum = Math.ceil(tableList.length * 0.5);
        //如果桌子列数数小于4 则填充假数据
        if (tablecolumnNum < 4) {
            var tempTable = 4 * 2 - tableList.length;
            for (i = 0; i < tempTable; i++) {
                tableList.push(0);
            }
        }
        for (i = 0; i < tableList.length; i += 2) {
            var arr = [];
            arr.push(tableList[i]);
            if (tableList[i + 1]) {
                arr.push(tableList[i + 1]);
            }
            this._tableViewList.push(arr);
        }
    },

    _refreshTableView: function () {
        var tempSize = this._tableView.getContainer().getContentSize();
        this._tableView.getContainer().setContentSize(cc.size(430 * Math.ceil(this._tableViewList.length), tempSize.height));
        // this._tableView.getContainer().setContentSize(cc.size(430 * Math.ceil(tableList.length * 0.5), tempSize.height));
        //只有在每次打开亲友圈牌桌类时接收到牌桌信息才刷新一次
        if (this._openTableWindowInfo) {
            this._tableView.reloadData();
            this._openTableWindowInfo = false;
        }
        ClubDataManager.setCurrentTableWindowRoomList(this._tableViewList);
        eventManager.dispatchEvent(ClubEvent.RefreshTableEvent,this._clubId);
    },

    /**
     * 刷新桌子
     * @private
     */
    _refreshTable: function () {
        if (!this._tableView || this._firstDataRequest['ClubBaseInfo'] || this._firstDataRequest['ListClubRoom']) {
            return;
        }
        this._refreshTableViewListData();
        this._refreshTableView();
    },


    /**
     * 操作按钮 收回
     * @param isRetract  是否收回
     * @private
     */
    _optBtnRetract: function (isRetract) {
        //成员按钮列表
        var memberBtnList = [ 'opt.btn_set', 'opt.btn_member', 'opt.btn_onEnter', 'opt.btn_refresh'];
        //群主按钮列表
        var ownerBtnList = ['opt.btn_set', 'opt.btn_onEnter', 'opt.btn_bindLiaoBei', 'opt.btn_refresh'];
        //管理员按钮列表
        var adminBtnList = ['bg_bottom.btn_sys', 'opt.btn_set', 'opt.btn_onEnter', 'opt.btn_refresh'];
        //不移动的按钮
        //var noMovedBtnList = ['bg_bottom.btn_zhanbang', 'bg_bottom.btn_sys'];

        var clubInfo = ClubDataManager.getClubData(this._clubId);

        var isOwner = clubInfo['owner_uid'] == gameData.uid;
        var isAdmin = ClubDataManager.isSelfAdministration(this._clubId, gameData.uid);

        var btnList = memberBtnList;
        if (isOwner) {
            btnList = ownerBtnList;
        } else if (isAdmin) {
            btnList = adminBtnList;
        }

        var i;
        for (i = 0; i < this._roomHideBtns.length; i++) {
            //if (noMovedBtnList.indexOf(this._roomHideBtns[i]) > -1) continue;
            var btnNamm = this._roomHideBtns[i];
            var index = btnList.indexOf(btnNamm);
            if (index >= 0) {
                this._nodeList[btnNamm].setVisible(false);
                btnList.splice(index, 1);
            }
        }

        var normalPoint = this._nodeList['opt.btn_retract'].getPosition();
        for (i = 0; i < btnList.length; i++) {
            var btn = this._nodeList[btnList[i]];
            //if (noMovedBtnList.indexOf(btnList[i]) > -1) continue;
            if (isRetract) {
                btn.runAction(
                    cc.sequence(cc.moveTo(0.1, normalPoint),
                        cc.callFunc(function (target) {
                            target.setVisible(false);
                        }.bind(this, btn)))
                );
            } else {
                btn.setVisible(true);
                var btnWidth = 72;
                if (btnList[i] == 'opt.btn_refresh') {
                    //刷新按钮的图片尺寸和别的按钮不一样大
                    btnWidth = 73;
                }
                btn.x = (normalPoint.x - (i + 1) * btnWidth);
            }
        }
    },

    /**
     * 获取显示桌子所需的数据
     * @param pos        楼层
     * @returns {Array}  数据列表
     */
    getViewTableData: function (pos) {
        var roomList = ClubDataManager.getClubFloorRomList(this._clubId, pos);
        var wanfasInfo = ClubDataManager.getClubFloorWanfaInfo(this._clubId, pos);
        var waitRoomList = ClubDataManager.getFormatClubRoomList(roomList, ClubTableItemType.Type_WaitJoin, pos);
        //var startRoomList = ClubDataManager.getFormatClubRoomList(roomList, ClubTableItemType.Type_StartRoom, pos);
        var wanfaRoomList = ClubDataManager.getWanfaFormatRoomList(wanfasInfo);
        //return wanfaRoomList.concat(waitRoomList).concat(startRoomList);
        return wanfaRoomList.concat(waitRoomList);
    },

    tableCellAtIndex: function (table, idx) {
        var cell = table.dequeueCell();
        var node = null;
        if (cell == null) {
            cc.log('创建桌子');
            cell = new cc.TableViewCell();
            node = addItem('ClubTableItem', cell, this._clubId, this._tableViewList[idx], this._currentFloor, idx);
            node.setName("itemCell");
        } else {
            node = cell.getChildByName("itemCell");
            node.setData(this._clubId, this._tableViewList[idx], this._currentFloor, idx);
        }
        return cell;
    },
    tableCellTouched: function (table, cell) {
    },
    tableCellSizeForIndex: function () {
        return cc.size(430, 580);
    },
    numberOfCellsInTableView: function () {
        return this._tableViewList.length;
    },
    _clubTableWindowClose: function () {
        this.close();
    },

    _onEnterRoomHandler: function () {
        this.close();
    },
    _clickTouchLayer: function () {

    },
    _clickClose: function () {
        this.close();
        //如果不是从小助手查看的 亲友圈大厅 点击返回的话 是需要显示ClubMainWindow界面的
        if (!ClubDataManager.getClubTableWindowState()) {
            ClubViewUtil.openClubMainWindow();
            gameData.returnClubId = null ;
        }
    },
    onExitTransitionDidStart: function () {
        cc.Node.prototype.onExitTransitionDidStart.call(this);
        this.unschedule(this._memberOffLineTimer);
        eventManager.removeListeners(this);
    },
});